package com.example.demo.services;

import com.example.demo.utils.ASMUtils;

import java.io.IOException;
import java.nio.file.*;
import java.util.*;

public class DependencyAnalyzerService {
    public Map<String, Set<String>> analyzeProjectDependencies(Path projectPath) throws IOException {
        Map<String, Set<String>> dependencies = new HashMap<>();

        Files.walk(projectPath)
                .filter(path -> path.toString().endsWith(".class"))
                .forEach(classFile -> {
                    try {
                        Set<String> classDependencies = ASMUtils.analyzeClassDependencies(classFile);
                        dependencies.put(classFile.toString(), classDependencies);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                });

        return dependencies;
    }

    public Map<String, Set<String>> analyzeJarDependencies(Path jarPath) throws IOException {
        return ASMUtils.analyzeJarDependencies(jarPath);
    }
<<<<<<< HEAD
}
=======
}
>>>>>>> ae04cf21c481035528eaf247571d600f597507d9
